feat(system): Load Uniscribe at runtime - #3241
Conversation
PR Summary by QodoLoad required Uniscribe APIs dynamically on Windows
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can type 'qodo, fix this' on a finding and the fix lands right on your PR |
|
| Filename | Overview |
|---|---|
| Core/Libraries/Source/WWVegas/WWLib/Usp10Loader.cpp | Implements synchronized lazy loading, export validation, wrapper forwarding, and explicit resource cleanup for the system Uniscribe library. |
| Core/Libraries/Source/WWVegas/WWLib/Usp10Loader.h | Defines the loader API and compatible Uniscribe types, flags, and function-pointer declarations without requiring the SDK header. |
| Core/Libraries/Source/WWVegas/WWLib/CMakeLists.txt | Adds the loader sources to core_wwlib under the existing Windows-only source gate. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
Caller[Text renderer caller] --> Wrapper[Usp10Loader wrapper]
Wrapper --> Load{Loader initialized?}
Load -->|No| SystemPath[Resolve Windows system directory]
SystemPath --> DLL[Load usp10.dll]
DLL --> Exports[Resolve and validate required exports]
Exports -->|Failure| Fallback[Return failure to caller]
Exports -->|Success| Invoke[Invoke Uniscribe function]
Load -->|Yes| Invoke
Invoke --> Result[Return Uniscribe result]
Shutdown[Engine shutdown] --> Unload[Free DLL and clear exports]
Reviews (5): Last reviewed commit: "feat(system): Load Uniscribe at runtime" | Re-trigger Greptile
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
68a4beb to
370c8ed
Compare
370c8ed to
9115581
Compare
There was a problem hiding this comment.
Meaning of USP10
USP10 stands for Uniscribe Script Processor version 1.0. This name reflects its primary function within the Windows operating system.
Functionality
- Uniscribe: This component is responsible for handling the proper formatting of Unicode text, especially for complex scripts.
- Script Processor: It processes text layout and rendering, ensuring that text appears correctly on the screen.
Versioning
- The "10" in USP10 indicates that it is the first version of the Uniscribe Script Processor, which is integral to the Windows operating system's ability to manage various languages and scripts.
There was a problem hiding this comment.
If microsoft bumps the version number... 😆 Looks like they did not in 28 years.
There was a problem hiding this comment.
well, that's true, this is very old tech from win 98SE era, i suppose it now got replaced with direct write, this is adding support for Arabic or rtl language and bidi without rewriting the backend, see https://learn.microsoft.com/en-us/windows/win32/intl/uniscribe
also, it has serval minor versions, see https://scripts.sil.org/cms/scripts/page.php?id=uniscribeversions&site_id=nrsi
9115581 to
b49c7f7
Compare
b49c7f7 to
61fa2cc
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 61fa2ccf19
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| HRESULT Usp10Loader::ScriptIsComplex(const WCHAR *text, int text_length, DWORD flags) | ||
| { | ||
| return load() ? ScriptIsComplexPtr(text, text_length, flags) : E_FAIL; |
There was a problem hiding this comment.
Keep the loader lock held while invoking exports
When unload() runs concurrently with any shaping call, load() releases CriticalSection before this expression reads and invokes the function pointer. The unloading thread can therefore call FreeLibrary() and null the pointers in that gap, causing the caller to invoke either a null pointer or code from an unloaded module. All export wrappers have this race; keep the lock held through each invocation or otherwise prevent unloading while calls are active.
Useful? React with 👍 / 👎.
Adds a small Windows-only runtime loader for the Uniscribe entry points required by the complex-text renderer.
The loader resolves the functions from the system
usp10.dllat runtime and reports failure to callers when Uniscribe is unavailable. This allows #3231 to retain the existing per-character renderer as its fallback while removing the compile-time dependency onusp10.handusp10.lib, which are missing from the VC6 SDK.The loader also provides synchronized shutdown cleanup; #3231 calls it from
WW3D::Shutdown().Cross-platform text shaping remains outside this focused compatibility change.
The stacked result was validated with:
usp10.dllgit diff --checkThe change was developed with AI assistance, then manually reviewed against the nearby runtime-loader pattern and the official Windows SDK function declarations.